package edu.neu.ecommerceplatform.dto;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;

public class CreateUserRequest {

    @NotBlank(message = "昵称不能为空")
    @Size(min = 2,max = 50, message = "昵称长度必须在 2 到 50 之间")
    private String name;

    @NotBlank(message = "电话号码不能为空")
    @Pattern(regexp = "^1[3-9]\\d{9}$", message = "电话号码格式不正确")
    private String phoneNumber;

    public @NotBlank(message = "昵称不能为空") @Size(min = 2, max = 50, message = "昵称长度必须在 2 到 50 之间") String getName() {
        return name;
    }

    public void setName(@NotBlank(message = "昵称不能为空") @Size(min = 2, max = 50, message = "昵称长度必须在 2 到 50 之间") String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "CreateUserRequest{" +
                "name='" + name + '\'' +
                ", phoneNumber='" + phoneNumber + '\'' +
                '}';
    }

    public @NotBlank(message = "电话号码不能为空") @Pattern(regexp = "^1[3-9]\\d{9}$", message = "电话号码格式不正确") String getPhoneNumber() {
        return phoneNumber;
    }

    public void setPhoneNumber(@NotBlank(message = "电话号码不能为空") @Pattern(regexp = "^1[3-9]\\d{9}$", message = "电话号码格式不正确") String phoneNumber) {
        this.phoneNumber = phoneNumber;
    }
}
